<meta http-equiv="content-type" content="text/html;charset=utf-8">
<?php 
include("config.php");

if(getenv('HTTP_CLIENT_IP')) { 
$onlineip = getenv('HTTP_CLIENT_IP');
} elseif(getenv('HTTP_X_FORWARDED_FOR')) { 
$onlineip = getenv('HTTP_X_FORWARDED_FOR');
} elseif(getenv('REMOTE_ADDR')) { 
$onlineip = getenv('REMOTE_ADDR');
} else { 
$onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
}

$address=$_POST["address"];
$usr=$_POST["user"];
$tag=$_POST["tag"];
$email=$_POST["email"];
$ip=$_POST["ip"];
$time=date("Y-m-d H:i:s");
$pass="yes";

$db=mysql_connect($servername,$sqlservername,$sqlserverpws);
mysql_select_db($sqlname,$db) ;
$sql="insert into $sqltable(address,user,tag,email,ip,pass,time) values('$address','$user','$tag','$email','$onlineip','$pass','$time') ";
mysql_query($sql);
echo ("<script type='text/javascript'> alert('添加成功');location.href='add.php';</script>");
?>